package joindemo.converter;

import joindemo.domain.dto.ArticleDto;
import joindemo.domain.po.ArticlePo;
import joindemo.domain.vo.ArticleVo;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

/**
 * @author pym
 */
@Mapper(componentModel = "spring")
public interface ArticleConverter {

    // PO -> DTO
    ArticlePo articleDtoToArticlePo(ArticleDto dto, Long userId);

    // PO -> VO
    @Mapping(target = "authorName", source = "authorName")
    ArticleVo articlePoToArticleVo(ArticlePo po, String authorName);
}